package com.cloudkinto.service.finance.vo.exportVo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;

/**
 * @author zhangyy
 * @date 2020/7/6 15:28
 * @description:
 */
@Data
public class OrderOutputVo {
    @Excel(name = "所属店铺", width = 20, needMerge = true)
    private String shopName;

    @Excel(name = "出库仓库", width = 20, needMerge = true)
    private String storageName;

    @Excel(name = "总费用", width = 10,  needMerge = true,  type = 10)
    private Double totalFee;

    @Excel(name = "快递费", width = 10,type = 10,  needMerge = true)
    private Double shipFee;

    @Excel(name = "耗材费", width = 10,type = 10,  needMerge = true)
    private Double outFee;

    @Excel(name = "操作费", width = 10,type = 10,  needMerge = true)
    private Double operateFee;

    @Excel(name = "取消费", width = 10,  needMerge = true, type = 10)
    private Double cancelFee;

    @Excel(name = "人工费", width = 10,   needMerge = true,type = 10)
    private Double laborFee;

    @Excel(name = "标签费", width = 10,  needMerge = true, type = 10)
    private Double labelFee;

    @Excel(name = "税费", width = 10,type = 10,  needMerge = true)
    private Double taxFee;

    @Excel(name = "截单费", needMerge = true, type = 10)
    private Double cutFee;

    @Excel(name = "出库单号", width = 20, needMerge = true)
    private String orderOutputNumber;

    @Excel(name = "主订单号", width = 30, needMerge = true)
    private String orderNo1;

    @Excel(name = "顾客订单号", width = 30, needMerge = true)
    private String orderNo;

    @Excel(name = "运单号", width = 20,  needMerge = true)
    private String trackNumber;

    @Excel(name = "快递公司", width = 20, needMerge = true)
    private String trackName;

    @Excel(name = "发货地址", width = 20, needMerge = true)
    private String address;

    @Excel(name = "出库时间", width = 20, format = "yyyy-MM-dd", needMerge = true)
    private Date sendTime;

    @ExcelCollection(name = "包裹信息")
    private List<OrderOutPackageVo> packageVoList;


    public Double getOperateFee() {
        if (operateFee == null) {
            return 0d;
        }

        return new BigDecimal(operateFee).setScale(2, RoundingMode.HALF_UP).doubleValue();
    }

    public Double getTaxFee() {
        if (taxFee == null) {
            return 0d;
        }

        return new BigDecimal(taxFee).setScale(2, RoundingMode.HALF_UP).doubleValue();
    }

    public Double getTotalFee() {
        if (totalFee == null) {
            return 0d;
        }

        return new BigDecimal(totalFee).setScale(2, RoundingMode.HALF_UP).doubleValue();
    }
}
